<template>
  <div class="app-search">
    <AppSearchHeader v-model:text="searchText" />
    <div class="container">
      <AppSearchTags v-if="isShowTags" />
      <AppSearchList v-else />
    </div>
  </div>
</template>

<script setup lang="ts">
import AppSearchHeader from "./AppSearchHeader.vue";
import AppSearchTags from "./AppSearchTags.vue";
import AppSearchList from "./AppSearchList.vue";
import { ref, computed } from "vue";

const searchText = ref<string>("");
// 计算属性生成一个判断是否展示最近搜索等内容的状态
const isShowTags = computed(() => !searchText.value);
</script>

<style lang="scss">
.app-search {
  height: 100%;
  .container {
    max-height: 200px;
    background-color: #fff;
  }
}
</style>
